﻿@using Web.My.Models
@model OrderControllerModel.Normal
<div class="my-main">
    <div class="ui-box  ui-box-alpha">
        <div class="ui-box-head">
            <div class="ui-box-head-border">
                <div class="ui-box-head-title">
                    订单中心</div>
                <a href="#" class="ui-box-head-more">去购物</a>
            </div>
        </div>
        <div class="ui-box-container">
            <div class="ui-box-content ui-box-content-special">
            </div>
        </div>
        <div class="ui-box-container-noborder">
            <div class="ui-box-content">
            </div>
        </div>
        <div class="ui-box-container-noborder">
            <table class="ui-table ui-table-inbox ui-table-alpha">
                <!-- 可以在class中加入ui-table-inbox或ui-table-noborder分别适应不同的情况 -->
                <thead>
                    <tr>
                        <th class="span4">
                            商品信息
                        </th>
                        <th class="span1">
                            单价(元)
                        </th>
                        <th class="span1">
                            数 量
                        </th>
                        <th class="span2">
                            订单金额(元)
                        </th>
                        <th class="span2">
                            订单状态
                        </th>
                        <th class="span2">
                            操 作
                        </th>
                    </tr>
                </thead>
                @Model.Orders.Each(@<tbody class="@(item.Item.OrderStatus == OrderStatus.Pending ? "item-pending" : "item")">
                    <tr class="item-header">
                        <td colspan="2">
                            订单号：@(item.Item.Id)
                        </td>
                        <td colspan="2">
                        </td>
                        <td colspan="2">
                            下单时间：@(item.Item.CreatedOn.ToString("yyyy-MM-dd HH:mm:ss"))
                        </td>
                    </tr>
                    @for (var i = 0; i < item.Item.OrderItems.Count; i++)
                    {
                        var tmp = item.Item.OrderItems[i];
                        <tr @(i < item.Item.OrderItems.Count - 1 ? "class=light" : string.Empty)>
                            <td class="col  @(item.Item.OrderItems.Count > 1 ? "multiple light" : string.Empty)">
                                <div class="media">
                                    <a class="pull-left" href="" target="_blank">
                                        <img data-src="holder.js/64x64" class="media-object" alt="64x64" style="width: 64px;
                                            height: 64px;" src="">
                                    </a>
                                    <div class="media-body">
                                        <h5 class="media-heading">
                                        </h5>
                                        枯干
                                    </div>
                                </div>
                            </td>
                            <td class="col @(item.Item.OrderItems.Count > 1 ? "multiple light" : string.Empty)">
                            </td>
                            <td class="col @(item.Item.OrderItems.Count > 1 ? "light" : string.Empty)">
                            </td>
                            @if (i == 0)
                            {
                                <td class="col" @(item.Item.OrderItems.Count > 1 ? "rowspan=" + (item.Item.OrderItems.Count) : string.Empty)>
                                </td>
                                <td class="col" @(item.Item.OrderItems.Count > 1 ? "rowspan=" + (item.Item.OrderItems.Count) : string.Empty)>
                                </td>
                                <td class="ui-table-action" @(item.Item.OrderItems.Count > 1 ? "rowspan=" + (item.Item.OrderItems.Count) : string.Empty)>
                                    @if (item.Item.OrderStatus == OrderStatus.Pending)
                                    {
                                        <a href="/order/pay?param=@(item.Item.Id)" target="_blank">付款</a>
                                    }
                                </td>
                            }
                        </tr>
                    }
                    <tr class="item-footer">
                        <td colspan="6">
                        </td>
                    </tr>
                </tbody>)
            </table>
        </div>
    </div>
</div>
